<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%String path = request.getContextPath();%>
<form id="pagerForm" method="post" action="<%=path %>/advertising/listAdvertising.action">
	<input type="hidden" name="pageRequest" value="1" />
	<input type="hidden" name="pageNum" value="${paginator.pageIndex}" />
	<input type="hidden" name="numPerPage" value="${paginator.pageSize}" />
</form>
<div class="pageHeader">
	<div class="searchBar">
		<form onsubmit="return navTabSearch(this);" rel="pagerForm" action="<%=path%>/advertising/listAdvertising.action" method="post">
			<ul class="searchContent">
				<li>
					<label style="text-align: right;">广告标题：</label>
					<input type="text" name="advertisingVO.title" value="${advertisingVO.title}"/>
				</li>
				<li>
					<label style="text-align: right;">位置：</label>
					<select name="advertisingVO.zone" class="combox">
						<option value="">所有位置</option>
						<option value="0"${advertisingVO.zone==0?" selected='true'":""}>首页</option>
						<option value="1"${advertisingVO.zone==1?" selected='true'":""}>轮换</option>
					</select>
				</li>
				<li>
					<label style="text-align: right;">链接类型：</label>
					<select name="advertisingVO.linkType" class="combox">
						<option value="">所有类型</option>
						<option value="0"${advertisingVO.linkType==0?" selected='true'":""}>会员卡</option>
						<option value="1"${advertisingVO.linkType==1?" selected='true'":""}>优惠券</option>
						<option value="2"${advertisingVO.linkType==2?" selected='true'":""}>站外</option>
					</select>
				</li>
			</ul>
			<ul class="searchContent">
				<li>
					<label style="text-align: right;">状态：</label>
					<select name="advertisingVO.state" class="combox">
						<option value="">所有状态</option>
						<option value="0"${advertisingVO.state==0?" selected='true'":""}>暂停</option>
						<option value="1"${advertisingVO.state==1?" selected='true'":""}>正常</option>
					</select>
				</li>
				<li style="width: 450px">
					<label style="text-align: right;">发布时间：</label>
					从<input type="text" name="advertisingVO.startIssueDate" value="${advertisingVO.startIssueDate}" dateFmt="yyyy-MM-dd HH:mm:ss" class="date param" readonly="false" size="19"/>
					到<input type="text" name="advertisingVO.endIssueDate" value="${advertisingVO.endIssueDate}" dateFmt="yyyy-MM-dd HH:mm:ss" class="date param" readonly="false" size="19"/>
				</li>
			</ul>
			<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">查询</button></div></div></li>
			</ul>
			</div>
		</form>
	</div>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<shiro:hasPermission name="addAdvertising">
			<li><a class="add" href="<%=path%>/advertising/addAdvertising.action" target="navTab" title="添加广告"><span>添加</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="deleteAdvertisings">
			<li><a title="确实要删除这些记录吗?" target="selectedTodo" rel="ids" postType="string" href="<%=path%>/advertising/deleteAdvertisings.action" class="delete"><span>删除</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="updateStateAdvertising">
			<li><a title="确实要恢复这些广告吗?" target="selectedTodo" rel="ids" postType="string" href="<%=path%>/advertising/updateStateAdvertising.action?advertisingVO.state=1" class="add"><span>恢复</span></a></li>
			<li><a title="确实要暂停这些广告吗?" target="selectedTodo" rel="ids" postType="string" href="<%=path%>/advertising/updateStateAdvertising.action?advertisingVO.state=0" class="delete"><span>暂停</span></a></li>
			</shiro:hasPermission>
		</ul>
	</div>
	<table class="table" width="100%" layoutH="164">
		<thead>
			<tr>
				<th width="30"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
				<th>广告标题</th>
				<th>状态</th>
				<th>位置</th>
				<th>广告图片</th>
				<th>链接类型</th>
				<th>站外地址</th>
				<th>链接ID</th>
				<th>排序值</th>
				<th>置顶</th>
				<th>添加者</th>
				<th>发布时间</th>
				<th>最后修改者</th>
				<th>最后修改时间</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<s:iterator value="advertisingList" id="advertising">
				<tr rel="<s:property value="id"/>">
					<td><input name="ids" value="<s:property value="id"/>" type="checkbox"></td>
					<td>${title}</td>
					<td>${state==0?"暂停":"正常"}</td>
					<td>${zone==0?"首页":"轮换"}</td>
					<td><a href="<%=path%>/jsp/common/preview_image.jsp?folder=advertising&picNames=${picNames}&id=${id}" target="dialog" rel="advertisingList" max="true" title="广告图片" width="800" height="480">查看图片</a></td>
					<td><s:if test="linkType==0">会员卡</s:if><s:elseif test="linkType==1">优惠券</s:elseif><s:elseif test="linkType==2">商家</s:elseif><s:elseif test="linkType==3">活动</s:elseif><s:else>站外</s:else></td>
					<td title="${linkUrl}">${linkUrl}</td>
					<td>${linkId}</td>
		            <td>${advertising.top}</td>
		            <td>
		             <shiro:hasPermission name="updateTopAdvertising">
		             	<a title="您确定要置顶该广告吗？置顶将优先显示！" target="ajaxTodo" href="<%=path%>/advertising/updateTopAdvertising.action?advertisingVO.id=${id}">置顶</a>
		             </shiro:hasPermission>
		             </td>
		             <td><s:property value="addUser.name" /></td>
		             <td><s:date format="yyyy-MM-dd HH:mm:ss" name="addTime"/></td>
		             <td><s:property value="updateUser.name" /></td>
		             <td><s:date format="yyyy-MM-dd HH:mm:ss" name="updateTime"/></td>
					<td>
						<shiro:hasPermission name="deleteAdvertising">
						<a title="确实要删除这条记录吗?" target="ajaxTodo" href="<%=path%>/advertising/deleteAdvertising.action?advertisingVO.id=<s:property value="id"/>" class="btnDel">删除</a>
						</shiro:hasPermission>
						<shiro:hasPermission name="editAdvertising">
						<a title="编辑" target="navTab" href="<%=path%>/advertising/editAdvertising.action?advertisingVO.id=<s:property value="id"/>" class="btnEdit">编辑</a>
						</shiro:hasPermission>
					</td>
				</tr>
			</s:iterator>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
				<span>显示</span>
				<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
					<option value="15" <c:if test="${paginator.pageSize==15}">selected='selected'</c:if> >15</option>
					<option value="30" <c:if test="${paginator.pageSize==30}">selected='selected'</c:if> >30</option>
					<option value="50" <c:if test="${paginator.pageSize==50}">selected='selected'</c:if> >50</option>
					<option value="100" <c:if test="${paginator.pageSize==100}">selected='selected'</c:if> >100</option>
					<option value="200" <c:if test="${paginator.pageSize==200}">selected='selected'</c:if> >200</option>
				</select>
				<span>条，共${paginator.totalCount}条</span>
			</div>
			<div class="pagination" targetType="navTab" totalCount="${paginator.totalCount}" 
				numPerPage="${paginator.pageSize}" pageNumShown="10" currentPage="${paginator.pageIndex}"></div>
	</div>
</div>